package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Repository
public interface UserDao {

    //添加
    @Insert("insert into user values (null,#{username},#{password})")
    public  boolean   add(User user);


    //删除
    @Delete("delete from user where id=#{id}")
    public  boolean  delete(Integer id);


    //修改
    @Update("update user set username=#{username},password=#{password} where id=#{id}")
    public  boolean update(User user);


    //查询单个
    @Select("select * from user where id=#{id}")
    public  User  findById(Integer id);


    //分页查询
    @Select("select * from user ")
    public List<User> findAll(int page, int size);
}
